package com.scau.beyondboy.services.impl;
import com.scau.beyondboy.dao.BaseDao;
import com.scau.beyondboy.dao.BookDao;
import com.scau.beyondboy.dao.UserDao;
import com.scau.beyondboy.model.BookEntity;
import com.scau.beyondboy.model.UserEntity;
import com.scau.beyondboy.services.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/**
 * Author:beyondboy
 * Gmail:xuguoli.scau@gmail.com
 * Date: 2015/12/13
 * Time: 20:42
 */
@Service(value = "bookService")
public class BookServiceImpl extends  BaseServiceImpl<BookEntity> implements BookService
{
    @Autowired
    private BookDao bookDao;
    @Resource(name = "bookDao")
    public void setDao(BaseDao<BookEntity> dao){
        super.setDao(dao);
        bookDao = (BookDao)dao;
    }
    @Override
    public void addBook(BookEntity bookEntity)
    {
        bookDao.insertBook(bookEntity);
    }
    @Override
    public void deleteBook(int bookId)
    {
        bookDao.deleteBook(bookId);
    }
    @Override
    public List<BookEntity> findAllBook()
    {
        return findAll();
    }
    @Override
    public BookEntity findBook(int id)
    {
        return bookDao.searchBoook(id);
    }
}
